﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PortalWeb.CMS.Core.Entity
{
    public class CommonModel
    {
        [Key]
        public int Id { get; set; }

        public string DefaultPicUrl { get; set; }
        public int Hits { get; set; }
        public string Inputer { get; set; }

        /// <summary>
        /// 模型名称
        /// </summary>
        public string Model { get; set; }

        public System.DateTime ReleaseDate { get; set; }
        public int Status { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Display(Name = "标题")]
        [Required(ErrorMessage = "必填")]
        [StringLength(255, ErrorMessage = "必须少于{0}个字")]
        public string Title { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        public virtual ICollection<Attachment> Attachment { get; set; }


        /// <summary>
        /// 咨询
        /// </summary>
        public virtual Consultation Consultation { get; set; }

        /// <summary>
        /// 栏目ID
        /// </summary>
        [Display(Name = "栏目ID")]
        [Required(ErrorMessage = "必填")]
        public int CategoryId { get; set; }

        /// <summary>
        /// 栏目
        /// </summary>
        public virtual Category Category { get; set; }

        /// <summary>
        /// 状态列表，只读静态变量
        /// </summary>
        public static Dictionary<int, string> StatusList
        {
            get
            {
                return new Dictionary<int, string>()
                {
                    {-3, "删除"},
                    {-2, "退稿"},
                    {-1, "草稿"},
                    {0, "未审核"},
                    {99, "正常"}
                };
            }
        }
    }
}